<template>
  <div>
    <el-row :gutter="7">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="150px">
        <el-col :span="24">
          <el-form-item label="发送邮件通知" prop="field102">
            <el-radio-group v-model="formData.field102" size="medium">
              <el-radio v-for="(item, index) in field102Options" :key="index" :label="item.value"
                :disabled="item.disabled">{{item.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="23">
          <el-form-item label="发送周期" prop="field103">
            <el-select v-model="formData.field103" placeholder="请选择发送周期" :disabled="formData.field102==2" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field103Options" :key="index" :label="item.label"
                :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="23">
          <el-form-item label="邮件模板" prop="field104">
            <el-select v-model="formData.field104" :disabled="formData.field102==2" placeholder="请选择邮件模板" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field104Options" :key="index" :label="item.label"
                :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item size="large">
            <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        field102: 2,
        field103: undefined,
        field104: undefined,
      },
      rules: {
        field102: [{
          required: true,
          message: '发送邮件通知不能为空',
          trigger: 'change'
        }],
        field103: [{
          required: true,
          message: '请选择发送周期',
          trigger: 'change'
        }],
        field104: [{
          required: true,
          message: '请选择邮件模板',
          trigger: 'change'
        }],
      },
      field102Options: [{
        "label": "开",
        "value": 1
      }, {
        "label": "关",
        "value": 2
      }],
      field103Options: [{
        "label": "间隔一小时",
        "value": 1
      }, {
        "label": "间隔一天",
        "value": 2
      }],
      field104Options: [{
        "label": "工单模板1",
        "value": 1
      }, {
        "label": "工单模板2",
        "value": 2
      }],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
  }
}

</script>
<style>
</style>
